/*
 * ProtocolParameter.java
 */
package org.sunspotworld.demo;

import com.sun.spot.peripheral.radio.IProprietaryRadio;
import com.sun.spot.peripheral.radio.IRadioPolicyManager;
import com.sun.spot.sensorboard.EDemoBoard;
import com.sun.spot.sensorboard.peripheral.ITriColorLED;
import com.sun.spot.sensorboard.peripheral.LEDColor;

/**
 *
 * @author mi zhang
 */
public interface ProtocolParameter {

    /**
     * LEDs, for DEBUGGING
     */
    public ITriColorLED leds[] = EDemoBoard.getInstance().getLEDs();
 // Status LED:
    public ITriColorLED statusLED = leds[0];
                                                //      Green:  Connected
                                                //      Red:    Temporarily lose connection
                                                //      Blue:   Permernently lose connection
 // Sampling LED:
    public ITriColorLED samplingLED = leds[1];
 // Signal strength LEDs:
    //private Vector signalStrengthVector;
    public ITriColorLED signalStrengthLED1 = leds[7];
    public ITriColorLED signalStrengthLED2 = leds[6];
    public ITriColorLED signalStrengthLED3 = leds[5];
    public ITriColorLED signalStrengthLED4 = leds[4];
    public ITriColorLED signalStrengthLED5 = leds[3];
    public ITriColorLED signalStrengthLED6 = leds[2];
 // Colors
    public LEDColor red   = new LEDColor(50,0,0);
    public LEDColor green = new LEDColor(0,50,0);
    public LEDColor blue  = new LEDColor(0,0,50);

    /**
     * Constants.
     */
    public static final int SECOND = 1000; // In milliseconds

    /**
     * Radio Settings.
     */
    public static final int INITIAL_CHANNEL_NUMBER = IProprietaryRadio.DEFAULT_CHANNEL;
    public static final short PAN_ID               = IRadioPolicyManager.DEFAULT_PAN_ID;
    public int channel = INITIAL_CHANNEL_NUMBER;
    public int power = 32;                             // Start with max transmit power
                                                        // In SunSPOT, the maximum is 0

    /**
     * Protocol Parameters.
     */
    public static final String HEARTBEAT_BROADCAST_PORT     = "100";
    public static final int HEARTBEAT_PERIOD                = 10 * SECOND;
    public static final int TIMEOUT_PERIOD                  = HEARTBEAT_PERIOD;
    public static final int MAX_MISSED_PACKETS              = 5;
    public static final int MAX_SLEEP_TIME                  = 2 * SECOND;
    public static final int DEEP_SLEEP_TIME                 = 5 * HEARTBEAT_PERIOD;
    public static final int SAMPLE_PERIOD                   = 10;  // 10 milliseconds
}
